home *** CD-ROM | disk | FTP | other *** search
/ Merciful 2 / Merciful - Disc 2.iso / software / d / databasev3.1reg.lha / db3.1 / Examples / ARexxDemos / playcdsong.db < prev    next >
Text File  |  1994-11-20  |  2KB  |  86 lines

  1. /* Rexxprogram for db that plays your favorite track on the CD you select.
  2.  *
  3.  * It needs a running InfraRexxDaemon to work properly.
  4.  * 
  5.  * Anders Callertun 1994
  6.  * 1994-11-13    First version
  7.  * 1994-11-15    Added some error messages.
  8.  * 1994-11-19    Made an English/Swedish version.
  9.  */
  10.  
  11. options results
  12.  
  13. lang = GetLang()
  14.  
  15. if ~show(p,infrarexx) then do
  16.     interpret OKAY1 sourceline(lang+1)
  17.     exit
  18. end
  19.  
  20. GETFIELD 'group'
  21. group = result
  22. GETFIELD 'title'
  23. title = result
  24. GETFIELD 'number'
  25. number = result
  26.  
  27. current_cd = '"'title'"' sourceline(lang+4) group
  28.  
  29. if getclip('current_cd')=='' then do
  30.     interpret OKAY2 sourceline(lang+2)
  31.     if result = 1 then do
  32.         call setclip('current_cd',current_cd)
  33.     end
  34.     else call setclip('current_cd',sourceline(lang+5))
  35. end
  36.  
  37. if getclip('current_cd') ~= current_cd then do
  38.     address infrarexx 'CD_OPEN_CLOSE'
  39.     interpret OKAY2 sourceline(lang+3)
  40.     if result = 0 then exit
  41. end
  42.  
  43. call setclip('current_cd',current_cd)
  44.  
  45. do while number>10                        /* This is how you select a track > 10    */
  46.     address infrarexx 'CD_PLUS_10'    /* on a CD player from JVC.                */
  47.     number = number-10                    /* You may have to change this            */
  48. end                                            /* for your CD player.                        */
  49.  
  50. address infrarexx 'CD_'number
  51. address infrarexx 'CD_PLAY'            /* Really not needed by JVC.                */
  52.  
  53. exit
  54.  
  55. GetLang:
  56.     if open(lang_file,'ENV:language',r) then do
  57.         language = readln(lang_file)
  58.         call close(lang_file)
  59.         select
  60.             when language = 'svenska' then return sourceline()-2*6
  61. /* If you add your own language, you must also add another when-statement like this:
  62.             when language = '<language>' then return sourceline()-3*6
  63. */            otherwise ;
  64.         end
  65.     end
  66.     
  67.     return sourceline()-1*6
  68. end
  69.  
  70. /*
  71. Here you may insert your own language. If you do, please send me a uuencoded copy
  72. of your file to d91-aca@nada.kth.se, so I can include it in the next release of db.
  73.  
  74. 'InfraRexxDaemon körs inte!'||'0a0a'x || 'Om du inte vet vad InfraRexx är, läs filen'||'a'x || '"About the examples" för att få reda på mer.'
  75. 'Har du'||'a'x || current_cd || 'a'x 'i din CD spelare nu?'
  76. 'Byt ut' || 'a'x || getclip('current_cd') || 'a'x || 'mot' || 'a'x || current_cd'!'
  77. av
  78. den okända CDn
  79.  
  80. 'The InfraRexxDaemon is not running!'||'0a0a'x || 'If you don''t know what InfraRexx is, please read the file'||'a'x ||'"About the examples" to find out more.'
  81. 'Do you have'||'a'x || current_cd || 'a'x 'in your CD player now?'
  82. 'Please replace' || 'a'x || getclip('current_cd') || 'a'x || 'with' || 'a'x || current_cd'!'
  83. by
  84. the unknown CD
  85. */
  86.